#include <iostream>
using std::cout;
using std::endl;

//给函数的参数赋默认值
//遵循从右往左的顺序
void func(int x = 1,int y = 0){
    cout << "x = " << x << endl;
    cout << "y = " << y << endl;
}

void test0(){
    func(10,9);

    //缺省调用
    func(10);
    func();
}

//函数声明与实现分离时
//如果要给函数参数赋默认值，建议写在声明中
void print(int x,int y = 0);

void test1(){
    print(8,7);
    print(8);
}

void print(int x,int y){
    cout << "x = " << x << endl;
    cout << "y = " << y << endl;
}

int main(void){
    test1();
    return 0;
}
